package Servlet;

import Shiti.Shopti;
import Shiti.Userti;
import service.Dingdanservice;
import service.Userservice;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
@WebServlet("/Xiudingservlet")
public class Xiudingservlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;utf-8");
        response.setCharacterEncoding("utf-8");
        PrintWriter out = response.getWriter();
        int acc= Integer.parseInt(request.getParameter("acc1"));
        int id = Integer.parseInt(request.getParameter("id1"));
        int num = Integer.parseInt(request.getParameter("num1"));
        Userti userti=new Userti(acc);
        Dingdanservice dingdanservice =new Dingdanservice();
        boolean a=dingdanservice.change(userti,num,id);
        if (a) {
            out.println("修改成功");
        }else {
            out.println("修改失败");
        }
    }
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
